import { create, StateCreator } from "zustand";
import { persist } from "zustand/middleware";

interface State {
  menuCollapsed: boolean;
}
interface Actions {
  toggleMenuCollapsed: () => void;
}

const creator: StateCreator<State & Actions> = set => ({
  menuCollapsed: false,
  toggleMenuCollapsed: () => set(state => ({ menuCollapsed: !state.menuCollapsed })),
});

export const useGlobalConf = create<State & Actions>()(persist(creator, { name: "globalConf" }));
